/**
  ******************************************************************************
  * @file   :   main.c
  * @version:
  * @author :
  * @brief  :
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright(c) . BLUEX Microelectronics.
  * All rights reserved.</center></h2>
  *
  *
  ******************************************************************************
  */

/* includes ------------------------------------------------------------------*/

#include "bx_kernel.h"
#include "user_app.h"

#include <easyflash.h>
#include "bx_shell.h"

#include "bx_service_spi.h"
#include "apollo_00_reg.h"
#include "bx_service_iic.h"
#include "bx_spi_type_def.h"
#include "bx_service_gpio.h"
#include "user_service_ble.h"

//#include "oled.h"
/* private define ------------------------------------------------------------*/

/* private typedef -----------------------------------------------------------*/

struct bx_spim_txrx_config * spim_data;
/* private variables ---------------------------------------------------------*/

extern s32 user_service_id;

/* exported variables --------------------------------------------------------*/

/*============================= private function =============================*/

/*========================= end of private function ==========================*/

/*============================= exported function ============================*/
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
void user_init( void )
{
    us_ble_register();
}


/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
void user_app( void )
{
		bx_subscibe( us_ble_id(), 100, 0, 0 );
    bx_repeat( 0,100,0,0,1000);
}
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
uint32_t send_count;
uint32_t send_count_bk;
bx_err_t user_msg_handle_func( s32 svc, u32 msg, u32 param0, u32 param1 )
{
    switch( msg ) {
        case 100:{
            //bxsh_logln("send_count:%u",send_count);
            uint32_t send_count_1s = send_count - send_count_bk;
            send_count_bk = send_count;
            bxsh_logln( "%u B/s", send_count_1s * 244 );
            } break;
        
        default:
            break;
    }
    return BX_OK;
}
/*========================= end of exported function =========================*/


/*============================= import function ==============================*/

/*=========================== end of import function =========================*/


/*============================ interrupt function ============================*/

/*========================= end of interrupt function ========================*/


/******************** (C) COPYRIGHT BLUEX **********************END OF FILE****/



